﻿/**
 * ...
 * @author sminutoli
 */

import com.dmotiko.general.*
import com.dmotiko.meip.*
import mx.utils.Delegate;
 
class com.dmotiko.meip.MainBtn extends com.dmotiko.general.ButtonClip
{
	private var section_listener:Function;
	
	private function initClip():Void {
		super.initClip();
		section_listener = Delegate.create(this, section_changed );
		Site.getApp().addEventListener( WebSite.SECTION_CHANGED, section_listener);
	}
	
	private function section_changed(e):Void 
	{
		var b:Boolean = e.section == this.data;
		if ( b ) onRollOver();
		setActive( b, true );
	}
	
	public function onRollOver():Void {
		this.gotoAndStop( "activo" );
	}
	public function onRollOut():Void {
		if ( bActive ) return;
		this.gotoAndStop( "normal" );
	}
	public function onRelease():Void {
		this.setActive( true );
	}
	
}